/*
 * Copyright (C) 2022 xuexiangjys(xuexiangjys@163.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.arthas.psimobile.fragment.home.postmail;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Spinner;

import androidx.annotation.NonNull;

import com.arthas.psimobile.core.BaseFragment;
import com.xuexiang.psimobile.R;
import com.xuexiang.psimobile.databinding.FragmentPostMailBinding;
import com.xuexiang.xaop.annotation.MemoryCache;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xpage.enums.CoreAnim;
import com.xuexiang.xui.adapter.simple.AdapterItem;
import com.xuexiang.xui.utils.ResUtils;
import com.xuexiang.xui.utils.SnackbarUtils;
import com.xuexiang.xui.utils.WidgetUtils;
import com.xuexiang.xui.widget.actionbar.TitleBar;
import com.xuexiang.xui.widget.spinner.materialspinner.MaterialSpinner;

import java.util.ArrayList;
import java.util.List;

@Page(anim = CoreAnim.none, name = "先寄件后付款")
public class MailPostFragment extends BaseFragment<FragmentPostMailBinding> implements View.OnClickListener {

    Spinner postmanSpinner;
    Spinner paymentSpinner;

    @Override
    protected TitleBar initTitle() {
        TitleBar titleBar = super.initTitle();
        titleBar.setBackground(getResources().getDrawable(R.drawable.titlebar_blue_cube));
        return titleBar;
    }

    @Override
    public void onClick(View view) {

    }

    @NonNull
    @Override
    protected FragmentPostMailBinding viewBindingInflate(LayoutInflater inflater, ViewGroup container) {
        return FragmentPostMailBinding.inflate(inflater, container, false);
    }

    @Override
    protected void initViews() {
        postmanSpinner = findViewById(R.id.spinner_postman);
        WidgetUtils.setSpinnerDropDownVerticalOffset(postmanSpinner);
    }

    @MemoryCache
    public List<AdapterItem> getAdapterItems() {
        List<AdapterItem> list = new ArrayList<>();
        String[] array = ResUtils.getStringArray(R.array.sort_mode_entry);
        for (String s : array) {
            list.add(new AdapterItem(s));
        }
        return list;
    }
}
